<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>顺风车订单</title>
		<link rel="stylesheet" href="${cxt }/css/iconfont.css" />
		<link rel="stylesheet" href="${cxt }/css/llp_order.css" />
		<link rel="stylesheet" href="${cxt }/css/llp_tan.css" />
		<script type="text/javascript" src="${cxt }/js/iconfont.js" ></script>
		<script type="text/javascript" src="${cxt }/js/jquery-3.2.1.js" ></script>
</head>
<script type="text/javascript">
	$().ready(function(){
		//获取系统时间
		var now = new Date();
		//获取年份,月份,日,时，分，秒
		var year = now.getFullYear();
		var month = now.getMonth() + 1;
		var day = now.getDate();
		var hour = now.getHours();
		var fen = now.getMinutes();
		var miao = now.getSeconds();
		var time = year+"-"+month+"-"+day+" "+hour+":"+fen+":"+miao
		//修改信息
		$(".update").click(function() {
			var id = $(this).parents("tr").find("td:eq(0)").text();
			var zt = $(this).parents("tr").find("td:eq(1)").text(); 
		
			var idcard = $(this).parents("tr").find("td:eq(3)").text();
			if(zt=='已付款'){
				//取车操作
				$.ajax({
					type:"post",
					url:"${cxt}/backstage/xghoajax1",
					data:{ddid:id,time1:time},
					dataType:"json",
					success:function(data){
	
						$("input[name=ddbh]").val(data.co_id);
						/* $("input[name=ddzt]").val(data.empsex); */
						$("input[name=csfz]").val(data.co_rent_idcard);
						$("input[name=cxmc]").val(data.co_car_type);
					
						
					}
				});
				
				
				$(".xgorder1").css("display","block");
			}
			if(zt=='租赁中'){
				
				//还车操作
				$.ajax({
					type:"post",
					url:"${cxt}/backstage/xghoajax2",
					data:{ddid2:id,time2:time},
					dataType:"json",
					success:function(data){
						$("input[name=ddbh2]").val(data.co_id);
						$("input[name=csfz2]").val(data.co_rent_idcard);
				
					}
				});
				
				$(".xgorder2").css("display","block");
			}
			
		});
		//弹出可以更改信息的框
		var width = $(window).width();
		var height = $(window).height();
		$(".xgorder1").css({
			"width":width,
			"height":height
		});
		$(".xgorder2").css({
			"width":width,
			"height":height
		});
		$(".ckxq").css({
			"width":width,
			"height":height
		});
		
		//弹框的按钮点击事件，取车弹框，还车弹框，查看详情
		$(".tan1").click(function(){
			$(".xgorder1").css("display","none");
		});
		$(".tan2").click(function(){
			$(".xgorder2").css("display","none");
		});
		$(".gb").click(function(){
			$(".ckxq").css("display","none");
		})
		
		//根据用户输入查询信息
		$(".selbtn").click(function() {
			var inputs = $(".findtext").val();
			$.ajax({
				type:"post",
				url:"${cxt}/backstage/selhitchorder",
				data:{seltext:inputs},
				dataType:"json",
				success:function(data){
					 console.log(data);
					$("#con").empty();
					for(var i=0;i<data.length;i++){
					 $("#con").append(
							 '<tr>'+
							'<td>'+data[i].hoid+'</td>'+
							'<td>'+data[i].hostatus+'</td>'+
							'<td>'+data[i].homoney+'</td>'+
							'<td>'+data[i].hoidcard+'</td>'+
							'<td>'+data[i].honame+'</td>'+
							'<td>'+data[i].hotel+'</td>'+
							'<td>'+data[i].remark+'</td>'+
							'<td>'+
								'<input class="update" type="button" value="修 改" />'+
							'</td>'+
							'<td>'+
							'<input class="selbtn" type="button" value="查看详情" />'+
							'</td>'+
						'</tr>' 
						); 
				}
				}
		});
		});			
		
		/* 查看详情 */
		$(".look").click(function(){
			var id = $(this).parents("tr").find("td:eq(0)").text();
			$.ajax({
				type:"post",
				url:"${cxt}/backstage/chakanajax",
				data:{fid:id},
				dataType:"json",
				success:function(data){
					console.log(data);
					alert(data[0]);
					$(".img3").html();
					$(".zcr3").html(data[2].rent_name);
					$(".lxdh3").html(data[2].rent_telephone);
					$(".cx3").html(data[3].co_car_type);
					$(".cph3").html(data[3].co_car_id);
					$(".ddzt3").html(data[3].co_order_status);
					
					$(".bz3").html(data[3].co_remark);
					$(".tjsj3").html(data[0].time_order_pay);
					$(".fksj3").html(data[0].time_order_pay);
					$(".sxsj3").html(data[0].time_plan_get);
					$(".wcsj3").html(data[0].time_fact_return);
					$(".qcsj3").html(data[0].time_fact_get);
				
					$(".hcsj3").html(data[0].time_fact_return);
					$(".qcmd3").html(data[3].co_get_store);
					$(".hcmd3").html(data[3].co_return_store);
					$(".zj3").html(100);
					$(".yj3").html(0);
					$(".bx3").html(0);
			
					$(".ps3").html(data[1].order_car_damage_money);
					$(".fwf3").html(data[1].order_service_money);
					$(".yfm3").html(data[3].co_plan_pay_money);
					$(".sfm3").html(data[3].co_plan_pay_money);
					$(".stm3").html(data[3].co_return_money);
					
				}
			});
			
			$(".ckxq").css("display","block");
		});
		
	});	
</script>
<body>
	<div class="contentdiv">
	<div class="top">
		<i class="iconfont icon-jibenshezhi"></i>
		<span>顺风车订单</span>
	</div>
	<div class="center">
		<div class="centertop">
			<div class="find">
				<input class="findtext" type="text" placeholder="请输入订单、电话、姓名、身份证"/>
				<input class="selbtn" type="button" value="查询"/>
			</div>
		</div>

		<div class="centerbutt">
			<table border="0" cellpadding="0" cellspacing="0">
				<tr>
					<th>编号</th>
					<th>状态</th>
					<th>金额</th>
					<th>身份证号码</th>
					<th>名称</th>
					<th>电话</th>
					<th>服务备注</th>
					<th>操作</th>
					<th>操作</th>
				</tr>
				<tbody id="con">
				<c:forEach items="${hoaelst }" var="hoalst">
				<tr>
					<td>${hoalst.hoid }</td>
					<td>${hoalst.hostatus }</td>
					<td>${hoalst.homoney }</td>
					<td>${hoalst.hoidcard }</td>
					<td>${hoalst.honame }</td>
					<td>${hoalst.hotel }</td>
					<td>${hoalst.remark }</td>
					<td>
						<input class="update" type="button" value="修 改" />
					</td>
					<td>
					<input class="look" type="button" value="查看详情" />
					</td>
				</tr>
				</c:forEach>
				
				</tbody>
				
			</table>
		</div>
		
		<div class="butt">
			<ul>
				<li>首页</li>
				<li><< 上一页</li>
				<li>下一页>></li>
				<li>末页</li>
			</ul>
		</div>
	</div>

</div>
<!-- 取车操作 -->
<div class="xgorder1">
			<div class="xgoinner">
			    <p>取车操作</p>	
				<div class="xgocontent">
				<form action="xghoa" method="post">
				订单编号:<input name="ddbh"/><br />
				订单状态:<select class="ddzt" name="ddzt">
						<option value="租赁中">租赁中</option>
						<option value="已失效">已失效</option>
						</select>
						<br/>
				身份证:<input name="csfz"/><br />
				车型名称:<input name="cxmc"/><br />
				车牌号:<input name="cph"/><br />
				操作人:<input name="copater"/><br />
				备注:<input name="cbz"/><br />
				
				<input class="tan1" type="submit" value="确定"/>
				</form>
				</div>

			</div>
		</div>
		
		<!-- 还车操作 -->
		<div class="xgorder2">
			<div class="xgoinner2">
			    <p>还车操作</p>	
				<div class="xgocontent2">
				<form action="xghoa2" method="post">
				订单编号:<input name="ddbh2"/><br />
				订单状态:<select class="ddzt2" name="ddzt2">
						<option value="已完成">已完成</option>
						</select>
						<br/>
				身份证:<input name="csfz2"/><br />
				基本破损费:<input name="cxmc2"/><br />
				服务费:<input name="cph2"/><br />
				赔偿费:<input name="copater2"/><br />
				备注:<input name="bz2"/><br />
				
				<input class="tan2" type="submit" value="确定"/>
				</form>
				</div>

			</div>
		</div>
		
		<!-- 查看详情 -->
		<div class="ckxq">
			<div class="ckxqinner">
			<span>查看详情</span>
			<table border="1" class="tb1" cellpadding="0" cellspacing="0" > 
				<tr>
					<td rowspan="3" class="img3">41651</td>
					<td height="45px" width="140px">租车人：${jsonArray }</td>
					<td height="45px" width="140px" class="zcr3"></td>
					<td height="45px" width="140px">联系电话：</td>
					<td height="45px" width="140px" class="lxdh3"></td>
				</tr>
				<tr>
					
					<td height="45px" >车型：</td>
					<td height="45px" class="cx3"></td>
					<td height="45px">车牌号：</td>
					<td height="45px" class="cph3"></td>
				</tr>
				<tr>
					
					<td height="45px">订单状态：</td>
					<td height="45px" class="ddzt3"></td>
					<td height="45px">备注：</td>
					<td height="45px" class="bz3"></td>
				</tr>
			</table>
			
			<table border="1" class="tb2" cellpadding="0" cellspacing="0" style="table-layout:fixed;">
				<tr>
					<td height="45px"> 订单提交时间：</td>
					<td height="45px" class="tjsj3"></td>
					<td height="45px">订单付款时间：</td>
					<td height="45px" class="fksj3"></td>
				</tr>
				<tr>
					<td height="45px">订单失效时间：</td>
					<td height="45px" class="sxsj3"></td>
					<td height="45px">订单完成时间：</td>
					<td height="45px" class="wcsj3"></td>
				</tr>
				</table>
				
			<table border="1" class="tb3" cellpadding="0" cellspacing="0" style="table-layout:fixed;">
				<tr>
					<td height="45px">取车时间：</td>
					<td height="45px" class="qcsj3"></td>
					<td height="45px">还车时间：</td>
					<td height="45px" class="hcsj3"></td>
				</tr>
				<tr>
					<td height="45px">取车门店：</td>
					<td height="45px" class="qcmd3"></td>
					<td height="45px">还车门店：</td>
					<td height="45px" class="hcmd3"></td>
				</tr>
				</table>
			
			<table border="1" class="tb4" cellpadding="0" cellspacing="0" style="table-layout:fixed;"> 
				<tr>
					<td height="45px">租金：</td>
					<td height="45px" class="zj3"></td>
					<td height="45px">押金：</td>
					<td height="45px" class="yj3"></td>
					<td height="45px">基本保险费：</td>
					<td height="45px" class="bx3"></td>
					<td height="45px">车辆破损费：</td>
					<td height="45px" class="ps3"></td>
				</tr>
				<tr>
					<td height="45px">服务费：</td>
					<td height="45px" class="fwf3"></td>
					<td height="45px">应付金额：</td>
					<td height="45px" class="yfm3"></td>
					<td height="45px">实收金额：</td>
					<td height="45px" class="sfm3"></td>
					<td height="45px">实退金额：</td>
					<td height="45px" class="stm3"></td>
				</tr>
				
			</table>
			<input class="gb" type="button" value="关   闭" />
			</div>
			
		</div>
</body>
</html>